package com.dapeis.api.spring.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import com.ag.spring.event.CommonEvent;
import com.ag.utils.SysConstant.SysCmd;
import com.ag.utils.TypeConvertUtils;

/**
 * 
 * Title:RestCommonReceiverListener.java RestCommonReceiverListener
 * Description:
 * @author yuanyong
 * @date 2016年11月13日 上午2:54:12 
 * Email: hzyuanyong@126.com
 *
 */
@Component
public class RestCommonReceiverListener implements ApplicationListener<CommonEvent> {
	public final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Override
    public void onApplicationEvent(final CommonEvent event) {
		if(SysCmd.INIT.equals(event.getCmd())) {
//			try {
//				TypeConvertUtils.fromProperties(AlipayConfig.class, "pay.alipay.");
//			} catch (InstantiationException | IllegalAccessException e) {
//				e.printStackTrace();
//			}
//			try {
//				TypeConvertUtils.fromProperties(WXpayConfig.class, "pay.wx.");
//			} catch (InstantiationException | IllegalAccessException e) {
//				e.printStackTrace();
//			}
			
//			int userId = 602784;
//			long orderId = 1512121624459271782L;
//			OrderService orderService = SpringUtils.getBean(OrderService.class);
//			Order order = orderService.selectByPrimaryKey(orderId);
//			SpringUtils.publishEvent(new CouponsActivitiesEvent(userId, CouponsActivities.TYPE_ONE_CONSUME, order));
		}
    }
}
